package kr.saeildamil.androidforstudy2.ch26;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class WordDBHelper extends SQLiteOpenHelper {
	final static String TAG = "WordDBHelper";
	
	public WordDBHelper(Context context){
		super(context, "EngWord.db", null, 2);
	}
	
	public void onCreate(SQLiteDatabase db) {
		Log.d(TAG, "onCreate(SQLiteDataBase db");
		String sql = "CREATE TABLE dic(" + 
					 "_id INTEGER PRIMARY KEY AUTOINCREMENT, " + 
					 "eng Text," + "han Text" + ");";
		db.execSQL(sql);
	}

	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		Log.d(TAG, "onUpgrade(SQLiteDataBase db, int oldVersion, int newVersion");
		String sql = "DROP TABLE IF EXISTS dic";
		db.execSQL(sql);
		onCreate(db);
	}

}
